﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using umbraco.NodeFactory;

namespace MartinsNeves.masterpages
{
    public partial class RedirectParent : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Node currentNode = Node.GetCurrent();
            if (currentNode != null)
            {
                Node parent = new Node(currentNode.Parent.Id);
                Response.Redirect(Page.ResolveUrl(parent.NiceUrl));
            }
        }
    }
}